package com.financing.platform.dao.impl;

import java.util.List;
import com.financing.platform.dao.impl.BaseDaoImpl;
import com.financing.platform.dao.IFpFundCFDao;
import com.financing.platform.dto.FpFundCFDTO;
import com.financing.platform.util.SqlName;
import java.sql.SQLException;
import java.util.Collections;

import org.springframework.stereotype.Repository;

/**
 * @Description:实现类
 * @author caojiayao
 * @version 1.0
 * @created 
 */
@Repository("fpFundCF")
public class FpFundCFDaoImpl extends BaseDaoImpl implements IFpFundCFDao {
	
	@Override
	public FpFundCFDTO getFpFundCF(Integer id) {
		try{
			return (FpFundCFDTO)this.sqlMapClient.queryForObject(SqlName.fpFundCF,id);
		} catch (SQLException e) {
			log.error("get fpFundCF error:",e);
			return null;
		}
	}
	
	
	@Override
	public Integer insertFpFundCF(FpFundCFDTO dto) {
		try {
		     return (Integer) this.sqlMapClient.insert(SqlName.insertFpFundCF,dto);
		} catch (SQLException e) {
			log.error("add fpFundCF error:",e);
			return 0;
		}
	}

	
	@Override
	public Integer updateFpFundCF(FpFundCFDTO dto) {
		try {
			return (Integer) this.sqlMapClient.update(SqlName.updateFpFundCF, dto);
		} catch (SQLException e) {
			this.log.error("update fpFundCF error 1!",e);
			return 0;
		}
	}
	
	@Override
	public Integer delFpFundCF(Integer id) {
		try{
			 return (Integer) this.sqlMapClient.delete(SqlName.delFpFundCF, id);
		} catch (SQLException e) {
			log.error("del fpFundCF error:",e);
			return 0;
		}
	}
	
	@Override
	public List<FpFundCFDTO> listFpFundCFByPage(FpFundCFDTO dto) {
		try {
			return (List<FpFundCFDTO>)this.sqlMapClient.queryForList(SqlName.listFpFundCFByPage, dto);
		} catch (SQLException e) {
			log.error("Query fpFundCF note list error !", e);
			return Collections.emptyList();
		}
	}
	
	@Override
	public List<FpFundCFDTO> listFpFundCF(FpFundCFDTO dto) {
		try {
			return (List<FpFundCFDTO>)this.sqlMapClient.queryForList(SqlName.listFpFundCF, dto);
		} catch (SQLException e) {
			log.error("Query fpFundCF note list error !", e);
			return Collections.emptyList();
		}
	}
	
	
	public Integer countFpFundCF(FpFundCFDTO dto){
		try {
			return (Integer)this.sqlMapClient.queryForObject(SqlName.countFpFundCF, dto);
		} catch (SQLException e) {
			log.error("Query fpFundCF note list error !", e);
			return 0;
		}
	}
	
}
